<%@page import="User.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("UTF-8");%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	User user = (User)session.getAttribute("user");
	if (user == null){
		user = new User();
		user.setID(-1);
		user.setPassword("");
		user.setType(User.STUDENT);
	}
%>
<script>
	function foo() {
		window.location.href = "register.jsp";
	}
</script>
	
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="silver">
<center>
	<form method="post" action="UserServlet?method=login">
		<table>
			<tr>
				<th>用户ID</th>
				<td width="80%"><input name="userID" value="<%=user.getID() < 0 ? "" : Integer.toString(user.getID())%>" /></td>
			</tr>
			<tr>
				<th>密码</th>
				<td><input name="password" type="password" value="<%= user.getPassword()%>" /></td>
			</tr>
			<tr>
				<th>用户类型</th>
				<td>
					学生 <input name="type" value="<%= User.STUDENT%>" type="radio" <%= user.getType() == User.STUDENT ? "checked" : "" %> />
					教师 <input name="type" value="<%= User.TEACHER%>" type="radio" <%= user.getType() == User.TEACHER ? "checked" : "" %> />
					鹳狸猿 <input name="type" value="<%= User.ADMIN%>" type="radio" <%= user.getType() == User.ADMIN ? "checked" : "" %> />
				</td>
			</tr>
		</table>
		<input type="button" onclick="foo()" value="注册">
		&nbsp;&nbsp;
		<input type="submit" value="登陆">
	</form>
</center>
</body>
</html>










